import { createRouter, createWebHistory } from 'vue-router'
import Home from '@/views/Home.vue'

const routes = [
  {
    path: '/',
    name: 'Client',
    redirect: to=>{
      return 'login';
    },
    component: Home,
    children: [
      { path:"/pork",          //type = 0
        name:"pork",
        component:()=> import('../views/dishes/pork.vue'),
      },
      { path:"/beef",          //type = 1
        name:"beef",
        component:()=> import('../views/dishes/beef.vue'),
      },
      { path:"/mutton",        //type = 2
        name:"mutton",
        component:()=> import('../views/dishes/mutton.vue'),
      },
      { path:"/vegetable",     //type = 3
        name:"vegetable",
        component:()=> import('../views/dishes/vegetables.vue'),
      },
      { path:"/aquatic",       //type = 4
        name:"aquatic",
        component:()=> import('../views/dishes/aquatic.vue'),
      },
      { path:"/bean",          //type = 5
        name:"bean",
        component:()=> import('../views/dishes/bean.vue'),
      },
      { path:"/egg",           //type = 6
        name:"egg",
        component:()=> import('../views/dishes/egg.vue'),
      },
      { path:"/food",          //type = 7
        name:"food",
        component:()=> import('../views/dishes/food.vue'),
      },
      {
        path: '/shopping',
        name: 'shopping',
        component: ()=>import('../views/Shopping.vue'),
      },
      {
        path: '/form',
        name: 'form',
        component: ()=>import('../views/Form.vue'),
      },
      {
        path: '/person',
        name: 'person',
        component: ()=>import('../views/Person.vue'),
      },

    ]
  },
  {
    path: '/login',
    name: 'Login',
    component: () => import('@/views/LoginView.vue')
  },
  {
    path: '/register',
    name: 'register',
    component: () => import('@/views/RegisterView.vue')
  },
  {
    path: '/home/dashboard',
    name: 'Dashboard',
    component: () => import('@/views/Dashboard.vue'),
    children: [
      {
        path: '/info',
        name: 'Home',
        component: Home,
        component: () => import('@/views/Info.vue'),
        meta: { title: '首页', icon: ['fas', 'house-user'], top: true }
      },
      // 系统设置
      {
        path: '/MealTime',
        name: 'SystemSettings',
        meta: { 
          title: '菜单', 
          icon: ['fas', 'gear'],
          top: true
        },
        children: [
          {
            path: '/P_pork',
            name: 'P_pork',
            component: () => import('@/views/MealTime/pork.vue'),
            meta: { 
              title: '猪肉类', 
              icon: ['fas', 'bell'] 
            }
          },
          {
            path: '/P_beef',
            name: 'P_beef',
            component: () => import('@/views/MealTime/beef.vue'),
            meta: { 
              title: '牛肉类', 
              icon: ['fas', 'bell'] 
            }
          },
          {
            path: '/P_mutton',
            name: 'P_mutton',
            component: () => import('@/views/MealTime/mutton.vue'),
            meta: { 
              title: '羊肉类', 
              icon: ['fas', 'bell'] 
            }
          },
          {
            path: '/P_aquatic',
            name: 'P_aquatic',
            component: () => import('@/views/MealTime/aquatic.vue'),
            meta: { 
              title: '水产类', 
              icon: ['fas', 'bell'] 
            }
          },
          {
            path: '/P_bean',
            name: 'P_bean',
            component: () => import('@/views/MealTime/bean.vue'),
            meta: { 
              title: '豆制品类', 
              icon: ['fas', 'bell'] 
            }
          },
          {
            path: '/P_vegetables',
            name: 'P_Vegetables',
            component: () => import('@/views/MealTime/vegetables.vue'),
            meta: { 
              title: '蔬菜类', 
              icon: ['fas', 'bell'] 
            }
          },
          {
            path: '/P_egg',
            name: 'P_egg',
            component: () => import('@/views/MealTime/egg.vue'),
            meta: { 
              title: '鸡蛋类', 
              icon: ['fas', 'bell'] 
            }
          },
          {
            path: '/P_food',
            name: 'P_food',
            component: () => import('@/views/MealTime/food.vue'),
            meta: { 
              title: '主食类', 
              icon: ['fas', 'bell'] 
            }
          }

        ]
      },

      // 用户管理
      {
        path: '/eatTime',
        name: 'UserManagement',
        meta: { 
          title: '用餐信息', 
          icon: ['fas', 'users'],
          top: true
        },
        children: [
          {
            path: '/mealtime',
            name: 'mealtime',
            component: () => import('@/views/eatTime/Mealtime.vue'),
            meta: { 
              title: '正在用餐人数', 
              icon: ['fas', 'list'] 
            }
          },
          {
            path: '/work',
            name: 'work',
            component: () => import('@/views/eatTime/eattime.vue'),
            meta: { 
              title: '平均用餐时间', 
              icon: ['fas', 'users-between-lines'] 
            }
          },
          {
            path: '/T2',
            name: 'T2',
            component: () => import('@/views/eatTime/others2.vue'),
            meta: { 
              title: '平均配餐时间', 
              icon: ['fas', 'right-to-bracket'] 
            }
          },
          {
            path: '/T1',
            name: 'T1',
            component: () => import('@/views/eatTime/others.vue'),
            meta: { 
              title: '累计收入', 
              icon: ['fas', 'clipboard-list'] 
            }
          }
        ]
      },
    ]
  },
          // 2、触摸一体机页面
  {
    path: '/machine',
    name: 'machine',
    component: ()=>import('../views/machine/Machine.vue'),
  },
    
   {
    path: '/table',
    name: 'table',
    component: ()=>import('../views/Table.vue'),
  },
]

const router = createRouter({
  history: createWebHistory(),
  routes
})

export default router